package com.visualize.demo.service;

import com.visualize.demo.model.JsonResponse;
import com.visualize.demo.model.Place;
import com.visualize.demo.model.RefreshRate;
import com.visualize.demo.repository.PlaceRepository;
import com.visualize.demo.repository.RefreshRateRepository;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class RefreshRateService extends BaseService {
    private final RefreshRateRepository refreshRateRepository;

    public RefreshRateService(RefreshRateRepository refreshRateRepository) {
        this.refreshRateRepository = refreshRateRepository;
    }


    public JsonResponse getData(String sTime, String eTime) {
        List<RefreshRate> refreshRateList = refreshRateRepository.getRefreshRateByTime(parseDate(sTime), parseDate(eTime));
        Map<String, List<RefreshRate>> content = new HashMap<>();
        content.put("list", refreshRateList);
        return new JsonResponse(200, content);
    }
}
